package com.woniuxy.service.impl;

import com.alibaba.fastjson.JSON;
import com.woniuxy.dao.StuPaperDao;
import com.woniuxy.entity.StuPaper;
import com.woniuxy.service.IStuPaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author ylr
 * @time 2022/06/13 20:20:35
 */
@Service
public class StuPaperServiceImpl implements IStuPaperService {

    @Autowired
    StuPaperDao stuPaperDao;

    @Override
    public Boolean addStuPaper(Map stuPaper) {
        //将result转为json字符串并保存至数据库中
        String result = JSON.toJSONString(stuPaper);
        stuPaper.put("result", result);
        return stuPaperDao.addStuPaper(stuPaper);
    }

    @Override
    public StuPaper findStuPaper(int uid, int pid) {
        return stuPaperDao.findStuPaper(uid, pid);
    }

}
